import numpy as np
from matplotlib import pyplot as plt
plt.rcParams['font.family']=['FangSong']
plt.rcParams['axes.unicode_minus'] = False
# 用Matplotlib画三角函数
x = np.linspace(-np.pi,np.pi,90,endpoint=True)
y = np.sin(x)
z = np.cos(x)
plt.title("三角函数")
plt.xlabel("x轴")
plt.ylabel("y轴")
plt.plot(x, y,label='sin(x)')
plt.plot(x, z,label='cos(x)')
plt.legend(loc='upper left')
plt.show()